#include "ARPResponder.h"
#include<netinet/ether.h>

void ARPResponder::writeResponse(u_char* sip, u_char* dip, u_char* dst_addr)
{
	libnet_build_arp(ARPHRD_ETHER,
				ETHERTYPE_IP,
				ETHER_ADDR_LEN,
				4,
				ARPOP_REPLY,
				this->hwaddr->ether_addr_octet,
				sip,
				dst_addr,
				dip,
				NULL,
				0,
				this->lnet,
				0);
	libnet_build_ethernet(dst_addr,
				this->hwaddr->ether_addr_octet,
				ETHERTYPE_ARP,
				NULL,
				0,
				this->lnet,
				0);
	write();
	cout << "wrote packet" << endl;
}
